<?ob_start();
session_start();
require_once ("model/m_admin.php");
 
  $admin = New M_admin();
   $name = $_GET['name'];
  $out= $admin->getMovieList($_GET['id']);

//$out .="\n";
echo $out;


// Open file export.csv.
$f = fopen ('export.txt','w');

// Put all values from $out to export.csv. 
fputs($f, $out);
fclose($f);
$size_in_bytes = strlen($out);

//header('Content-type: application/csv');
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$name.'.txt"');
readfile('export.txt');
//

?>